<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailayer_conv2d.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ailayer__conv2d_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ailayer_conv2d.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ailayer__conv2d_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#ifndef CONV2D_LAYER</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="preprocessor">#define CONV2D_LAYER</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aifes__core_8h.html">core/aifes_core.h</a>&quot;</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">#define AIFES_CHANNELS_FIRST    1</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">#define AIFES_CHANNELS_LAST     -1</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#define AIFES_PADDING_SAME      0xFFFF  </span><span class="comment">// Not fully implemented yet</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#define AIFES_PADDING_VALID     0</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structailayer__conv2d.html">ailayer_conv2d</a>   <a class="code" href="structailayer__conv2d.html">ailayer_conv2d_t</a>;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html">   57</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structailayer__conv2d.html">ailayer_conv2d</a> {</div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#ab13782a46e3804246bf82a92955096b3">   58</a></span>&#160;    <a class="code" href="structailayer.html">ailayer_t</a> <a class="code" href="structailayer__conv2d.html#ab13782a46e3804246bf82a92955096b3">base</a>; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="comment">// Values (configurable)</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a59c6e19f34d008496193ce360f1dfcd8">   67</a></span>&#160;    uint32_t <a class="code" href="structailayer__conv2d.html#a59c6e19f34d008496193ce360f1dfcd8">filter_count</a>;  </div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#ae6e2b314ce35aeb4932aa39cda034050">   68</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#ae6e2b314ce35aeb4932aa39cda034050">kernel_size</a>[2];    </div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">   70</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2];  </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">   71</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">dilation</a>[2];  </div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">   72</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2];  <span class="comment">// AIFES_PADDING_SAME = 0xFFFF</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">   74</a></span>&#160;    int8_t <a class="code" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>; </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#abaaf545fb7c9d3a0b80aa5a460202e04">   81</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__conv2d.html#abaaf545fb7c9d3a0b80aa5a460202e04">weights</a>; </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a87664225b3b1ad7ec4cb74cc8bd8f349">   82</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__conv2d.html#a87664225b3b1ad7ec4cb74cc8bd8f349">bias</a>;   </div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#adcb2718497f38fbec0be11d4b58d8d52">   84</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#adcb2718497f38fbec0be11d4b58d8d52">weights_shape</a>[4]; </div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a2f0b1dbeba330cf6ef798b0f91cd0a80">   85</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#a2f0b1dbeba330cf6ef798b0f91cd0a80">bias_shape</a>[1]; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">   87</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__conv2d.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">trainable_params</a>[2]; </div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a33b189c78566d57ad498dbf2cc364917">   88</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__conv2d.html#a33b189c78566d57ad498dbf2cc364917">gradients</a>[2]; </div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a590c48e998a8a740439e38d0aa4302dd">   89</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="structailayer__conv2d.html#a590c48e998a8a740439e38d0aa4302dd">optimem</a>[2];   </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a2228267b8286358702df06ee781106b6">   92</a></span>&#160;    uint16_t <a class="code" href="structailayer__conv2d.html#a2228267b8286358702df06ee781106b6">result_shape</a>[4]; </div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a743f36a791c13ebcb85902a1eaf00d09">  117</a></span>&#160;    void (*<a class="code" href="structailayer__conv2d.html#a743f36a791c13ebcb85902a1eaf00d09">conv2d_fwd</a>)(</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *input,</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2],    <span class="comment">// [s_h, s_w]</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">dilation</a>[2],  <span class="comment">// [d_h, d_w]</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2],   <span class="comment">// AIFES_PADDING_SAME not allowed</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__conv2d.html#abaaf545fb7c9d3a0b80aa5a460202e04">weights</a>,</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__conv2d.html#a87664225b3b1ad7ec4cb74cc8bd8f349">bias</a>,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                    int8_t <a class="code" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>,</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                    <span class="keywordtype">void</span> *work_space,</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;                    <a class="code" href="structaitensor.html">aitensor_t</a> *output</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                    );</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a23140176b9fc4d64477428bb866e56ab">  146</a></span>&#160;    void (*<a class="code" href="structailayer__conv2d.html#a23140176b9fc4d64477428bb866e56ab">conv2d_bwd</a>)(</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *input,</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2],    <span class="comment">// [s_h, s_w]</span></div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">dilation</a>[2],  <span class="comment">// [d_h, d_w]</span></div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2],</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *output,</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                    int8_t <a class="code" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>,</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;                    <span class="keywordtype">void</span> *work_space,</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;                    <a class="code" href="structaitensor.html">aitensor_t</a> *d_weights</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    );</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a369c40f2555882551a24b1cfcf086074">  176</a></span>&#160;    void (*<a class="code" href="structailayer__conv2d.html#a369c40f2555882551a24b1cfcf086074">conv2d_bwd_full</a>)(</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *delta_out,</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2],    <span class="comment">// [s_h, s_w]</span></div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">dilation</a>[2],  <span class="comment">// [d_h, d_w]</span></div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;                    <span class="keyword">const</span> uint16_t <a class="code" href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2],</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                    <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__conv2d.html#abaaf545fb7c9d3a0b80aa5a460202e04">weights</a>,</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                    int8_t <a class="code" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>,</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                    <span class="keywordtype">void</span> *work_space,</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;                    <a class="code" href="structaitensor.html">aitensor_t</a> *delta_in</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    );</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#a7674445f16490c6cacdb03157feab8c7">  194</a></span>&#160;    void (*<a class="code" href="structailayer__conv2d.html#a7674445f16490c6cacdb03157feab8c7">tensor_add</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *a, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *b, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160; </div>
<div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="structailayer__conv2d.html#ab9fbfe94ba23731680568a7905d278e6">  203</a></span>&#160;    void (*<a class="code" href="structailayer__conv2d.html#ab9fbfe94ba23731680568a7905d278e6">sum_channelwise</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="code" href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;};</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structaicore__layertype.html">aicore_layertype_t</a> *<a class="code" href="ailayer__conv2d_8h.html#a8b624b70925024d3f4bf9dc4942c65d7">ailayer_conv2d_type</a>;</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#af680fe00203e68206b815de978e3f75a">  224</a></span>&#160;<a class="code" href="structailayer.html">ailayer_t</a> *<a class="code" href="ailayer__conv2d_8h.html#af680fe00203e68206b815de978e3f75a">ailayer_conv2d</a>(<a class="code" href="structailayer__conv2d.html">ailayer_conv2d_t</a> *layer, <a class="code" href="structailayer.html">ailayer_t</a> *input_layer);</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160; </div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#afdb46935c87c4f914061e0626e46bfdd">  249</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#afdb46935c87c4f914061e0626e46bfdd">ailayer_conv2d_forward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160; </div>
<div class="line"><a name="l00284"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a95639fd326393e4a8a28b90382291b8d">  284</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#a95639fd326393e4a8a28b90382291b8d">ailayer_conv2d_backward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160; </div>
<div class="line"><a name="l00301"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a034cebc1ea6532ff376a93433f784ea9">  301</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#a034cebc1ea6532ff376a93433f784ea9">ailayer_conv2d_calc_result_shape</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160; </div>
<div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a3bbb7315e89362248b98c9a3f69e9246">  312</a></span>&#160;uint32_t <a class="code" href="ailayer__conv2d_8h.html#a3bbb7315e89362248b98c9a3f69e9246">ailayer_conv2d_sizeof_bwdmem</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160; </div>
<div class="line"><a name="l00324"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#af08f7cdbd99086e1afc32f361c74e677">  324</a></span>&#160;uint32_t <a class="code" href="ailayer__conv2d_8h.html#af08f7cdbd99086e1afc32f361c74e677">ailayer_conv2d_sizeof_paramem</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160; </div>
<div class="line"><a name="l00337"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a9b45da2f05f3af40d7b1d533a2ef6416">  337</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#a9b45da2f05f3af40d7b1d533a2ef6416">ailayer_conv2d_set_paramem</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>, <span class="keywordtype">void</span> *memory_ptr);</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160; </div>
<div class="line"><a name="l00348"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a81907232bdcd49146c385c319da1ac9b">  348</a></span>&#160;uint32_t <a class="code" href="ailayer__conv2d_8h.html#a81907232bdcd49146c385c319da1ac9b">ailayer_conv2d_sizeof_trainmem</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160; </div>
<div class="line"><a name="l00359"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#ad96151728506a3fe4121d74b8f94b609">  359</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#ad96151728506a3fe4121d74b8f94b609">ailayer_conv2d_set_trainmem</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>, <span class="keywordtype">void</span> *memory_ptr);</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160; </div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;<span class="preprocessor">#ifdef AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00366"></a><span class="lineno"><a class="line" href="ailayer__conv2d_8h.html#a941843e9236cfa862443070e0035ec67">  366</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__conv2d_8h.html#a941843e9236cfa862443070e0035ec67">ailayer_conv2d_print_specs</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160; </div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// CONV2D_LAYER</span></div>
<div class="ttc" id="aaifes__core_8h_html"><div class="ttname"><a href="aifes__core_8h.html">aifes_core.h</a></div><div class="ttdoc">AIfES 2 core interface.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a034cebc1ea6532ff376a93433f784ea9"><div class="ttname"><a href="ailayer__conv2d_8h.html#a034cebc1ea6532ff376a93433f784ea9">ailayer_conv2d_calc_result_shape</a></div><div class="ttdeci">void ailayer_conv2d_calc_result_shape(ailayer_t *self)</div><div class="ttdoc">Calculate the shape of the result tensor (ailayer.result)</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a3bbb7315e89362248b98c9a3f69e9246"><div class="ttname"><a href="ailayer__conv2d_8h.html#a3bbb7315e89362248b98c9a3f69e9246">ailayer_conv2d_sizeof_bwdmem</a></div><div class="ttdeci">uint32_t ailayer_conv2d_sizeof_bwdmem(const ailayer_t *self)</div><div class="ttdoc">Calculate and return the memory size needed for temporary results of the backward pass.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a81907232bdcd49146c385c319da1ac9b"><div class="ttname"><a href="ailayer__conv2d_8h.html#a81907232bdcd49146c385c319da1ac9b">ailayer_conv2d_sizeof_trainmem</a></div><div class="ttdeci">uint32_t ailayer_conv2d_sizeof_trainmem(const ailayer_t *self)</div><div class="ttdoc">Calculate and return the memory size needed by this layer for training.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a8b624b70925024d3f4bf9dc4942c65d7"><div class="ttname"><a href="ailayer__conv2d_8h.html#a8b624b70925024d3f4bf9dc4942c65d7">ailayer_conv2d_type</a></div><div class="ttdeci">const aicore_layertype_t * ailayer_conv2d_type</div><div class="ttdoc">Conv2D layer type.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a941843e9236cfa862443070e0035ec67"><div class="ttname"><a href="ailayer__conv2d_8h.html#a941843e9236cfa862443070e0035ec67">ailayer_conv2d_print_specs</a></div><div class="ttdeci">void ailayer_conv2d_print_specs(const ailayer_t *self)</div><div class="ttdoc">Print the layer specification.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a95639fd326393e4a8a28b90382291b8d"><div class="ttname"><a href="ailayer__conv2d_8h.html#a95639fd326393e4a8a28b90382291b8d">ailayer_conv2d_backward</a></div><div class="ttdeci">void ailayer_conv2d_backward(ailayer_t *self)</div><div class="ttdoc">Calculate the backward pass for given Conv2D layer.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_a9b45da2f05f3af40d7b1d533a2ef6416"><div class="ttname"><a href="ailayer__conv2d_8h.html#a9b45da2f05f3af40d7b1d533a2ef6416">ailayer_conv2d_set_paramem</a></div><div class="ttdeci">void ailayer_conv2d_set_paramem(ailayer_t *self, void *memory_ptr)</div><div class="ttdoc">Distribute provided memory to the parameter pointers.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_ad96151728506a3fe4121d74b8f94b609"><div class="ttname"><a href="ailayer__conv2d_8h.html#ad96151728506a3fe4121d74b8f94b609">ailayer_conv2d_set_trainmem</a></div><div class="ttdeci">void ailayer_conv2d_set_trainmem(ailayer_t *self, void *memory_ptr)</div><div class="ttdoc">Distribute provided memory to the gradients pointers.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_af08f7cdbd99086e1afc32f361c74e677"><div class="ttname"><a href="ailayer__conv2d_8h.html#af08f7cdbd99086e1afc32f361c74e677">ailayer_conv2d_sizeof_paramem</a></div><div class="ttdeci">uint32_t ailayer_conv2d_sizeof_paramem(const ailayer_t *self)</div><div class="ttdoc">Calculate and return the parameter memory size needed for this layer.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_af680fe00203e68206b815de978e3f75a"><div class="ttname"><a href="ailayer__conv2d_8h.html#af680fe00203e68206b815de978e3f75a">ailayer_conv2d</a></div><div class="ttdeci">ailayer_t * ailayer_conv2d(ailayer_conv2d_t *layer, ailayer_t *input_layer)</div><div class="ttdoc">Initialize and connect the given Conv2D layer.</div></div>
<div class="ttc" id="aailayer__conv2d_8h_html_afdb46935c87c4f914061e0626e46bfdd"><div class="ttname"><a href="ailayer__conv2d_8h.html#afdb46935c87c4f914061e0626e46bfdd">ailayer_conv2d_forward</a></div><div class="ttdeci">void ailayer_conv2d_forward(ailayer_t *self)</div><div class="ttdoc">Calculate the forward pass for given Conv2D layer.</div></div>
<div class="ttc" id="astructaicore__layertype_html"><div class="ttname"><a href="structaicore__layertype.html">aicore_layertype</a></div><div class="ttdoc">Type indicator of the layer.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:82</div></div>
<div class="ttc" id="astructailayer__conv2d_html"><div class="ttname"><a href="structailayer__conv2d.html">ailayer_conv2d</a></div><div class="ttdoc">General Conv2D layer  structure.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:57</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a2228267b8286358702df06ee781106b6"><div class="ttname"><a href="structailayer__conv2d.html#a2228267b8286358702df06ee781106b6">ailayer_conv2d::result_shape</a></div><div class="ttdeci">uint16_t result_shape[4]</div><div class="ttdoc">The shape of the result.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:92</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a23140176b9fc4d64477428bb866e56ab"><div class="ttname"><a href="structailayer__conv2d.html#a23140176b9fc4d64477428bb866e56ab">ailayer_conv2d::conv2d_bwd</a></div><div class="ttdeci">void(* conv2d_bwd)(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *output, int8_t channel_axis, void *work_space, aitensor_t *d_weights)</div><div class="ttdoc">Required math function: Gradients of 2D-Convolution with respect to the weights.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:146</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a2f0b1dbeba330cf6ef798b0f91cd0a80"><div class="ttname"><a href="structailayer__conv2d.html#a2f0b1dbeba330cf6ef798b0f91cd0a80">ailayer_conv2d::bias_shape</a></div><div class="ttdeci">uint16_t bias_shape[1]</div><div class="ttdoc">Bias weights tensor shape.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:85</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a33b189c78566d57ad498dbf2cc364917"><div class="ttname"><a href="structailayer__conv2d.html#a33b189c78566d57ad498dbf2cc364917">ailayer_conv2d::gradients</a></div><div class="ttdeci">aitensor_t * gradients[2]</div><div class="ttdoc">Gradients structure for the backpropagation algorithm.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:88</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a369c40f2555882551a24b1cfcf086074"><div class="ttname"><a href="structailayer__conv2d.html#a369c40f2555882551a24b1cfcf086074">ailayer_conv2d::conv2d_bwd_full</a></div><div class="ttdeci">void(* conv2d_bwd_full)(const aitensor_t *delta_out, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *weights, int8_t channel_axis, void *work_space, aitensor_t *delta_in)</div><div class="ttdoc">Required math function: Gradients of 2D-Convolution with respect to the input.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:176</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a590c48e998a8a740439e38d0aa4302dd"><div class="ttname"><a href="structailayer__conv2d.html#a590c48e998a8a740439e38d0aa4302dd">ailayer_conv2d::optimem</a></div><div class="ttdeci">void * optimem[2]</div><div class="ttdoc">Memory field used by the optimizer for training.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:89</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a59c6e19f34d008496193ce360f1dfcd8"><div class="ttname"><a href="structailayer__conv2d.html#a59c6e19f34d008496193ce360f1dfcd8">ailayer_conv2d::filter_count</a></div><div class="ttdeci">uint32_t filter_count</div><div class="ttdoc">Number of filters ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:67</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a743f36a791c13ebcb85902a1eaf00d09"><div class="ttname"><a href="structailayer__conv2d.html#a743f36a791c13ebcb85902a1eaf00d09">ailayer_conv2d::conv2d_fwd</a></div><div class="ttdeci">void(* conv2d_fwd)(const aitensor_t *input, const uint16_t stride[2], const uint16_t dilation[2], const uint16_t padding[2], const aitensor_t *weights, const aitensor_t *bias, int8_t channel_axis, void *work_space, aitensor_t *output)</div><div class="ttdoc">Required math function: 2D-Convolution.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:117</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a7674445f16490c6cacdb03157feab8c7"><div class="ttname"><a href="structailayer__conv2d.html#a7674445f16490c6cacdb03157feab8c7">ailayer_conv2d::tensor_add</a></div><div class="ttdeci">void(* tensor_add)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Required math function: Element wise tensor addition.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:194</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a87664225b3b1ad7ec4cb74cc8bd8f349"><div class="ttname"><a href="structailayer__conv2d.html#a87664225b3b1ad7ec4cb74cc8bd8f349">ailayer_conv2d::bias</a></div><div class="ttdeci">aitensor_t bias</div><div class="ttdoc">Tensor containing the bias weights.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:82</div></div>
<div class="ttc" id="astructailayer__conv2d_html_a959391eb5884c07d76585cdc37480edf"><div class="ttname"><a href="structailayer__conv2d.html#a959391eb5884c07d76585cdc37480edf">ailayer_conv2d::padding</a></div><div class="ttdeci">uint16_t padding[2]</div><div class="ttdoc">The (symmetric) zero padding in the direction of height and width ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:72</div></div>
<div class="ttc" id="astructailayer__conv2d_html_aae9b175c98f22cb88ce0ad348b075d14"><div class="ttname"><a href="structailayer__conv2d.html#aae9b175c98f22cb88ce0ad348b075d14">ailayer_conv2d::stride</a></div><div class="ttdeci">uint16_t stride[2]</div><div class="ttdoc">The stride in the direction of height and width ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:70</div></div>
<div class="ttc" id="astructailayer__conv2d_html_ab13782a46e3804246bf82a92955096b3"><div class="ttname"><a href="structailayer__conv2d.html#ab13782a46e3804246bf82a92955096b3">ailayer_conv2d::base</a></div><div class="ttdeci">ailayer_t base</div><div class="ttdoc">Inherited field members from general ailayer struct.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:58</div></div>
<div class="ttc" id="astructailayer__conv2d_html_ab9fbfe94ba23731680568a7905d278e6"><div class="ttname"><a href="structailayer__conv2d.html#ab9fbfe94ba23731680568a7905d278e6">ailayer_conv2d::sum_channelwise</a></div><div class="ttdeci">void(* sum_channelwise)(const aitensor_t *x, int8_t channel_axis, aitensor_t *result)</div><div class="ttdoc">Required math function: Channel-wise sum.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:203</div></div>
<div class="ttc" id="astructailayer__conv2d_html_abaaf545fb7c9d3a0b80aa5a460202e04"><div class="ttname"><a href="structailayer__conv2d.html#abaaf545fb7c9d3a0b80aa5a460202e04">ailayer_conv2d::weights</a></div><div class="ttdeci">aitensor_t weights</div><div class="ttdoc">Tensor containing the weights.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:81</div></div>
<div class="ttc" id="astructailayer__conv2d_html_adcb2718497f38fbec0be11d4b58d8d52"><div class="ttname"><a href="structailayer__conv2d.html#adcb2718497f38fbec0be11d4b58d8d52">ailayer_conv2d::weights_shape</a></div><div class="ttdeci">uint16_t weights_shape[4]</div><div class="ttdoc">Weights tensor shape.</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:84</div></div>
<div class="ttc" id="astructailayer__conv2d_html_ae6e2b314ce35aeb4932aa39cda034050"><div class="ttname"><a href="structailayer__conv2d.html#ae6e2b314ce35aeb4932aa39cda034050">ailayer_conv2d::kernel_size</a></div><div class="ttdeci">uint16_t kernel_size[2]</div><div class="ttdoc">Size of the kernels ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:68</div></div>
<div class="ttc" id="astructailayer__conv2d_html_af52d89e468d9a89e4658ec34a1b85299"><div class="ttname"><a href="structailayer__conv2d.html#af52d89e468d9a89e4658ec34a1b85299">ailayer_conv2d::dilation</a></div><div class="ttdeci">uint16_t dilation[2]</div><div class="ttdoc">The dilation in the direction of height and width ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:71</div></div>
<div class="ttc" id="astructailayer__conv2d_html_afcc6c64ff572ae7408fe1c4bcfe7b9d1"><div class="ttname"><a href="structailayer__conv2d.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">ailayer_conv2d::trainable_params</a></div><div class="ttdeci">aitensor_t * trainable_params[2]</div><div class="ttdoc">Pointer to the weights and bias (which are the trainable parameters).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:87</div></div>
<div class="ttc" id="astructailayer__conv2d_html_afcee94774a3c5f173a071b67da9cc3a5"><div class="ttname"><a href="structailayer__conv2d.html#afcee94774a3c5f173a071b67da9cc3a5">ailayer_conv2d::channel_axis</a></div><div class="ttdeci">int8_t channel_axis</div><div class="ttdoc">Index of the channel axis (1 for channels first and -1 or 3 for channels last).</div><div class="ttdef"><b>Definition:</b> ailayer_conv2d.h:74</div></div>
<div class="ttc" id="astructailayer_html"><div class="ttname"><a href="structailayer.html">ailayer</a></div><div class="ttdoc">AIfES layer interface.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:252</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_5233a5861230ad4bc52bfd822c86fe04.html">cnn</a></li><li class="navelem"><a class="el" href="dir_a5c91e9bbf64c4b6a24d0c0102e9d7da.html">base</a></li><li class="navelem"><a class="el" href="dir_115795935351339455fee6eae515097b.html">ailayer</a></li><li class="navelem"><a class="el" href="ailayer__conv2d_8h.html">ailayer_conv2d.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
